// 只触发一次
const EventEmitter = require('events');

class MyEmitter extends EventEmitter { };

const myEmitter = new MyEmitter();

myEmitter.once('testFun', function (a, b) {
  console.log(`${a} + ${b} = ${a + b}`);
})

myEmitter.emit('testFun', 3, 5)
myEmitter.emit('testFun', 3, 6) // 不会触发